An algebraic Riccati equation for linear operators is studied, which arises in systems theory. For the case that all involved operators are unbounded, the existence of infinitely many selfadjoint solutions is shown. To this end, invariant graph subspaces of the associated Hamiltonian operator matrix are constructed by means of a Riesz basis with parentheses of generalised eigenvectors and two indefinite inner products. Under additional assumptions, the existence and a representation of all bounded solutions is obtained. The theory is applied to Riccati equations of differential operators.